package com.zsck.commonbase.util;

import android.view.View;
import android.view.View.OnClickListener;

/**
 * 两次点击之间加入500毫秒的延迟，用于避免快速点击多次触发问题
 *
 */
public abstract class OnDelayClickListener implements OnClickListener {

	private long mLastClickTime = 0;
	private int mDelayTime = 1000;

	@Override
	public void onClick(View v) {
		long clickTime = System.currentTimeMillis();
		if (clickTime - mLastClickTime > mDelayTime) {
			onDelayClick(v);
			mLastClickTime = clickTime;
		}
	}

	protected abstract void onDelayClick(View v);

}
